<template>
  <div class="app-container">
    <div class="content">
      <div class="rightHeader">
        <div class="header">
          <div class="logoBox">
            <img src="@/assets/images/logo.png" alt="" />
          </div>
          <el-form
            :model="queryParams"
            ref="queryForm"
            size="large"
            :inline="true"
            :rules="queryRules"
          >
            <el-form-item label="账号:" prop="pickedWho">
              <el-input
                v-model="queryParams.pickedWho"
                placeholder="请输入账号"
                clearable
                @keyup.enter.native="handleQuery"
              />
            </el-form-item>
            <el-form-item label="批号:" prop="lotatt04">
              <el-input
                v-model="queryParams.lotatt04"
                placeholder="请输入批号"
                clearable
                @keyup.enter.native="handleQuery"
              />
            </el-form-item>
            <el-form-item label="箱号:" prop="udf02">
              <el-input
                v-model="queryParams.udf02"
                placeholder="请输入箱号"
                clearable
                @keyup.enter.native="handleQuery"
              />
            </el-form-item>
            <!-- <el-form-item label="日期:">
            <el-date-picker
              v-model="dateRange"
              style="width: 245px"
              value-format="yyyy-MM-dd"
              type="daterange"
              range-separator="-"
              start-placeholder="开始日期"
              end-placeholder="结束日期"
            ></el-date-picker>
          </el-form-item> -->
            <el-form-item>
              <el-button
                type="primary"
                icon="el-icon-search"
                size="medium"
                @click="handleQuery"
                >搜索</el-button
              >
              <el-button
                type="primary"
                icon="el-icon-refresh"
                size="medium"
                @click="resetQuery"
                >重置</el-button
              >
            </el-form-item>
          </el-form>
        </div>
        <div class="footer">
          <img src="@/assets/images/back.png" alt="" @click="goBack" />
          <span @click="goBack">退出</span>
        </div>
      </div>
      <div class="wtable">
        <el-table
          :data="tableData"
          class="tableContent"
          height="750"
          v-loading="loading"
          element-loading-text="拼命加载中"
          element-loading-spinner="el-icon-loading"
          element-loading-background="rgba(0, 0, 0, 0.8)"
        >
          <el-table-column
            fixed
            prop="customerDescr1"
            label="货主"
            align="center"
            width="160"
          >
          </el-table-column>
          <el-table-column
            fixed
            prop="orderNo"
            label="发运订单号"
            width="120"
            align="center"
          >
          </el-table-column>
          <el-table-column
            prop="sostatusC"
            label="发运单状态"
            width="120"
            align="center"
          >
          </el-table-column>
          <el-table-column
            prop="tihWay"
            label="提货方式"
            width="120"
            align="center"
          >
          </el-table-column>
          <el-table-column
            prop="orderlineNo"
            label="订单行号"
            width="120"
            align="center"
          >
          </el-table-column>
          <el-table-column
            prop="js"
            label="件数"
            width="120"
            align="center"
          ></el-table-column>
          <el-table-column
            prop="udf01"
            label="拣货目标跟踪号"
            width="130"
            align="center"
          ></el-table-column>
          <el-table-column
            prop="udf02"
            label="箱号"
            width="120"
            align="center"
          ></el-table-column>

          <el-table-column
            prop="alternateSku4"
            label="生产厂家"
            width="120"
            align="center"
          >
          </el-table-column>
          <el-table-column
            prop="lotatt04"
            label="批号"
            width="120"
            align="center"
          ></el-table-column>
          <el-table-column
            prop="lotatt01"
            label="生产日期"
            width="120"
            align="center"
          ></el-table-column>
          <el-table-column
            prop="lotatt02"
            label="有效期"
            width="120"
            align="center"
          ></el-table-column>
          <el-table-column
            prop="qtyorderedEach"
            label="订单数量"
            width="120"
            align="center"
          ></el-table-column>
          <el-table-column
            prop="qtyallocatedEach"
            label="分配数量"
            width="120"
            align="center"
          ></el-table-column>
          <el-table-column
            prop="location"
            label="分配拣货库位"
            width="120"
            align="center"
          ></el-table-column>
          <el-table-column
            prop="pickedwhoC"
            label="拣货人"
            width="120"
            align="center"
          ></el-table-column>
          <el-table-column
            prop="qtypickedEach"
            label="拣货数量"
            width="120"
            align="center"
          ></el-table-column>
          <el-table-column
            prop="pickedTime"
            label="拣货时间"
            width="150"
            align="center"
          ></el-table-column>
          <el-table-column
            prop="checkwhoC"
            label="复核人"
            width="120"
            align="center"
          ></el-table-column>
          <el-table-column
            prop="checkTime"
            label="复核时间"
            width="120"
            align="center"
          ></el-table-column>
          <el-table-column
            prop="packId"
            label="包装代码"
            width="120"
            align="center"
          ></el-table-column>

          <el-table-column
            prop="aadstatusC"
            label="出库指令状态"
            width="120"
            align="center"
          >
          </el-table-column>
          <el-table-column
            prop="skudescr1"
            label="产品描述"
            width="120"
            align="center"
          >
          </el-table-column>
          <el-table-column
            prop="alternateSku3"
            label="规格"
            width="140"
            align="center"
          >
          </el-table-column>
          <el-table-column
            prop="udf03"
            label="复核台"
            width="120"
            align="center"
          ></el-table-column>
          <el-table-column
            prop="grouptraceId"
            label="箱号编组"
            width="120"
            align="center"
          ></el-table-column>
          <el-table-column
            prop="singleMatch"
            label="订单结构"
            width="120"
            align="center"
          >
          </el-table-column>
        </el-table>
        <div>
          <pagination
            v-show="total > 0"
            :total="total"
            :page.sync="queryParams.pageNum"
            :limit.sync="queryParams.pageSize"
            @pagination="handleQuery"
          />
        </div>
      </div>
    </div>
    <el-dialog
      title="提示"
      :visible.sync="dialogVisible"
      width="30%"
      @close="dialogVisible = false"
    >
      <span>未查询到数据</span>
    </el-dialog>
  </div>
</template>

<script>
import { getOutbound } from "@/api/subSystem/continer";
export default {
  data() {
    return {
      // 日期范围
      // dateRange: [],
      // 弹窗隐藏
      dialogVisible: false,
      // 总条数
      total: 0,
      loading: false,
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        pickedWho: null,
        lotatt04: null,
        udf02: null,
      },
      initialTableData: [], // 初始状态的表格数据
      tableData: [],
      queryRules: {
        pickedWho: [{ required: true, message: "请输入账号", trigger: "blur" }],
        lotatt04: [{ required: false, message: "请输入账号", trigger: "blur" }],
        udf02: [{ required: false, message: "请输入账号", trigger: "blur" }],
      },
    };
  },
  methods: {
    resetQuery() {
      this.tableData = [...this.initialTableData];
      this.queryParams.pickedWho = "";
      this.queryParams.lotatt04 = "";
      this.queryParams.udf02 = "";
    },
    goBack() {
      this.$router.push("/subSystem1");
    },
    handleQuery() {
      this.$refs.queryForm.validate((valid) => {
        if (valid) {
          this.loading = true;
          getOutbound(this.queryParams).then((res) => {
            if (Array.isArray(res.rows) && res.rows.length > 0) {
              this.tableData = res.rows;
              this.total = res.total;
              this.loading = false;
            } else {
              this.tableData = res.rows;
              this.total = res.total;
              this.dialogVisible = true;
              this.loading = false;
            }
          });
        }
      });
    },
  },
};
</script>

<style lang="scss" scoped>
.app-container {
  padding: 0 !important;
  width: 100%;
  height: 100%;
  background: url("../assets/images/hcbanner2.jpg") no-repeat;
  overflow: hidden;
  ::v-deep .el-table__empty-block {
    width: 100%;
    min-width: 100%;
    max-width: 100%;
  }
  ::v-deep .el-form-item__label {
    color: #fff;
    font-size: 22px;
    font-weight: 400;
  }
  ::v-deep .el-input--small .el-input__inner {
    height: 40px;
  }
  ::v-deep .el-pagination__jump {
    color: #ffffff;
  }
  ::v-deep .el-pagination__total {
    color: #ffffff;
  }
  ::v-deep .el-pagination {
    margin-right: 78px;
  }
  .pagination-container {
    background: transparent;
    margin-top: 5px !important;
    padding: 0px 20px !important;
  }
  .content {
    height: 100%;
  }
  .rightHeader {
    margin-top: 70px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    .header {
      display: flex;
      justify-content: flex-start;
      margin-left: 30px;
      .logoBox {
        width: 200px;
        margin-right: 255px;
        margin-top: -60px;
        margin-left: -20px;
        img {
          width: 200%;
        }
      }
    }
    .footer {
      display: flex;
      align-items: center;
      cursor: pointer;
      margin-top: -50px;
      color: #ffffff5d;
      font-size: 18px;
      img {
        width: 30%;
      }
      span {
        display: block;
        margin-left: -37px;
        margin-top: 15px;
        font-size: 12px;
      }
    }
  }
  .hname {
    width: 40px;
  }
  .el-button--medium {
    margin-left: 10px;
    font-size: 18px;
  }
  .wtable {
    width: 100%;
    text-align: center;
  }
  .tableContent {
    margin: 0 auto;
    width: 96%;
    margin-top: 0;
  }
  ::v-deep .el-form-item__label {
    color: #fff;
  }
  ::v-deep .el-input {
    width: 100%;
    font-size: 16px;
  }
  ::v-deep .el-dialog:not(.is-fullscreen) {
    margin-top: 40vh !important;
  }
  ::v-deep .el-pagination.is-background .btn-next:disabled {
    color: #797a7b;
  }
  ::v-deep .el-pagination.is-background .btn-prev:disabled {
    color: #797a7b;
  }
  ::v-deep .el-pagination span:not([class*="suffix"]) {
    min-width: 56px;
  }
  ::v-deep .el-date-editor .el-range-input{
    font-size: 15px;
  }
}
</style>